library(crosstalk)
library(plotly)
library(tidyverse)
library(palmerpenguins)
df <- SharedData$new(penguins)
Connected scatter plots
g1 <- ggplot(df, aes(bill_length_mm, bill_depth_mm)) +
geom_point()
g2 <- ggplot(df, aes(flipper_length_mm, body_mass_g)) +
geom_point()
bscols(ggplotly(g1) %>%
# remove display bar and zoom feature
config(displayModeBar = F) %>%
layout(xaxis=list(fixedrange=TRUE),
yaxis=list(fixedrange=TRUE)),
ggplotly(g2) %>%
# remove display bar and zoom feature
config(displayModeBar = F) %>%
layout(xaxis=list(fixedrange=TRUE),
yaxis=list(fixedrange=TRUE)) )